﻿using System;

namespace CollegeSim.Domain.Entities
{
    // Author: Ryan Redburn
    // Project: CollegeSim
    // Date: 5/6/2014

    /// <summary>
    /// Class used to represent a semester. Contains properties.
    /// </summary>
    public class Semester
    {
        #region [ Fields ]

        private string _name;

        #endregion

        #region [ Properties ]

        // SemesterID
        // Set by DB
        public int SemesterID { get; set; }

        /// <summary>
        /// Semester name. Spring, summer, etc.
        /// </summary>
        public string Name
        {
            get { return _name; }
            set
            {
                if (!String.IsNullOrWhiteSpace(value))
                {
                    if (value.Length <= 15)
                    {
                        _name = value;
                    }
                    else
                    {
                        throw new ArgumentOutOfRangeException("value", "Name must be 15 characters or less.");
                    }
                }
                else
                {
                    throw new ArgumentNullException("value", "Name cannot be null or empty.");
                }
            }
        }

        #endregion

        #region [ Constructors ]

        // Initailize SemesterID
        public Semester()
        {
            SemesterID = 0;
        }

        #endregion
    }
}
